<script setup lang="ts">
import { Button } from "@purchasing/components"
import { useExport, ExportColumn } from "../composables/export"

export interface Props {
  text?: string
  url: string
  params: Record<string, any>
  columns: ExportColumn[]
}

const props = withDefaults(defineProps<Props>(), { text: "导出" })

const { isExporting, executeExport } = useExport(
  props.url,
  props.params,
  props.columns,
)
</script>

<template>
  <Button :loading="isExporting" @click="executeExport">
    {{ props.text }}
  </Button>
</template>
